// 封装 showToast
export const showToast = (params) => {
  return new Promise ((resolve, reject) => {
    wx.showToast({
      ...params,
      success: res => {
        resolve(res)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}


// 封装一个 login
export const login = () => {
  return new Promise((resolve, reject) => {
    wx.login({
      success: res => {
        resolve(res)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}

// 封装一个获取用户基本信息 getUserProfile
export const getUserProfile = (params) => {
  return new Promise((resolve, reject) => {
    wx.getUserProfile({
      ...params,
      success: res => {
        resolve(res)
      },
      fail: err => {
        reject(err)
      }
    })
  })
}